<#import '/ftlLibrary/properteisVariable.ftl' as pv/>
<link href="assets/css/bootstrap-select.css" rel="stylesheet" />
<script src="assets/js/select2/select2.js"></script>
<div class="row">
	<!-- 映射列表 -->
	<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12" id="leftTree">
		<div class="widget flat radius-bordered">
			<div class="widget-header bg-sky theme"> <span class="widget-caption">会员课时包列表</span> </div>
			<div class="widget-body no-padding">
				<div class="table-scrollable">
					<!-- 数据表列信息列表 -->
					<table class="table table-bordered dataTable">
						<thead>
						<tr>
							<th title="选择" class="checkboxColumnTh fixedColumn " fixed-align="left"> </th>
							<th title="课时包名称">课时包名称</th>
							<th title="剩余课时数">剩余课时数</th>
							<th title="可用课时包">可用课时包</th>
							<th title="剩余有效时期">剩余有效时期</th>
							<th title="课时包状态">课时包状态</th>
							<th title="总课时数">总课时数</th>
							<th title="原单价">原单价</th>
							<th title="现单价">现单价</th>
							<th title="总价">总价</th>
							<th title="所属顾问">所属顾问</th>
							<th title="使用状态">使用状态</th>
							<th class="操作" >操作</th>
							<th title="备注信息">备注信息</th>
						</tr>
						</thead>
						<tbody>
						<input type="hidden" name="memberType" class="memberType" value="${memberType}">
						<#if memberPackagesList?size==0>
							<tr>
								<td align="center">无数据</td>
							</tr>
						</#if>
						<#list memberPackagesList as data>
							<tr>
								<td class="checkboxColumnTd"><label>
									<input type="radio" class="chk"  name="id" value="${data.id}">
									<span class="text"></span> </label>
								</td>
								<td>${(data.tssPackage.name???string(data.tssPackage.name?html,"未设置"))!'未设置'}</td>
								<td>${(data.surplusClassHour???string(data.surplusClassHour?html,"未设置"))!'未设置'}</td>
								<td>${(data.usableTotal???string(data.usableTotal?html,"未设置"))!'未设置'}</td>
								<td>${(data.surplusValidDate???string(data.surplusValidDate?html,"未设置"))!'未设置'}</td>
								<td>${(data.packageStatus???string(data.packageStatus?html,"未设置"))!'未设置'}</td>
								<td>${(data.packageId???string(data.packageId?html,"未设置"))!'未设置'}</td>
								<td>${(data.surplusClassHour???string(data.surplusClassHour?html,"未设置"))!'未设置'}</td>
								<td>${(data.usableTotal???string(data.usableTotal?html,"未设置"))!'未设置'}</td>
								<td>${(data.surplusValidDate???string(data.surplusValidDate?html,"未设置"))!'未设置'}</td>
								<td>${(data.packageStatus???string(data.packageStatus?html,"未设置"))!'未设置'}</td>
								<td>${(data.packageStatus???string(data.packageStatus?html,"未设置"))!'未设置'}</td>
								<td align="center">
									<a>使用</a>
									<a targetDateId="${data.id}" onclick="activetePackageStatus(this)" packageStatus="1" >激活</a>
									<a>注销</a>
									<a class="btn btn-default btn-xs icon-only green update" href="javascript:void(0);"  serializeNum="${serializeNum}"  editUrl="/tssStudentController/toEditView.do?type=1" targetDataId="${data.memberId}"><i class="fa  fa-edit"></i></a> </td>
								<td>${(data.packageStatus???string(data.packageStatus?html,"未设置"))!'未设置'}</td>

							</tr>
						</#list>
						</tbody>

					</table>
				</div>
				${pagingBar} </div>
		</div>
	</div>
</div>
<script>
    $(".selectpicker").select2();

    /**
	 * 修改状态
     */
    function activetePackageStatus(that){
        var packageStatus=$(that).attr("packageStatus");
        var targetDateId=$(that).attr("targetDateId");
        alert(targetDateId);
        alert(packageStatus);
        ajaxRequest("tssMemberPackageController/updatePackageStatus.do",{
            targetDateId:targetDateId,
            packageStatus:packageStatus
		}, function (result) {
            alert(result.resMsg);
            if (result.resCode == 200) {
                bootbox.hideAll();
            }
        },function(){
            ajaxError("加载页面失败");
        }, "post","json")
	}

</script>
